<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>promise.then</title>
  </head>
  <body></body>
  <script>
    new Promise((resolve, reject) => {
      //   resolve("一瓶可乐");
      //状态一但改变就不可修改
      reject("没有可乐");
    })
      .then(
        (value) => {
          console.log(value);
        },
        (reason) => {
          console.log(reason);
        }
      )
      .then(
        (a) => console.log("成功"),
        (b) => console.log("失败")
      );
    //promise.then返回一个新的promise，默认是resolved状态
  </script>
</html>
